﻿using System;

namespace Red.Scripts.Defines.Utilities
{
    public static class Flags
    {
        public static T Add<T>( this Enum type, T value )
        {
            return (T)(object)( ( (int)(object)type | (int)(object)value ) );
        }

        public static T Add<T>( this Enum type, T value, bool condition )
        {
            if ( condition )
                return Add( type, value );

            return (T)(object)type;
        }
    }
}
